from elasticsearch_dsl import connections, Search
from elasticsearch_dsl.query import MultiMatch

es_url = '219.224.134.214:9506'

es = connections.create_connection(hosts=[es_url])


# 去重查询相应的字段
hexun = Search().using(es).index('hexun')
hexun.aggs.bucket('one_kind', 'terms', field='plate')
response = hexun.execute()
for one in response.aggregations.one_kind.buckets:
    print(one.key)
    print(one.doc_count)
